class Purchase < ActiveRecord::Base
  has_many :offers
  belongs_to :vendor, :counter_cache => true
  belongs_to :true_offer,
    :class_name => "Offer",
    :foreign_key => "offer_id"
  belongs_to :applicant
  belongs_to :category
  belongs_to :auditor
  belongs_to :leader, :class_name => 'Auditor', :foreign_key => 'leader_id'                  #设备处最终审批人
  belongs_to :dept_leader, :class_name => "Applicant", :foreign_key => "dept_leader_id"      #部门审核人


  def self.findPidSendMesg purId
    find(:last,:conditions=>['id = ? and release_status = ? ',purId,'未发布'])
  end
end
